package com.example.myretrofit2.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import com.example.myretrofit2.AdActivity;
import com.example.myretrofit2.R;

public class SppashActivity extends AppCompatActivity {
ImageView imageView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sppash);
        initView();
    }
    public void initView(){
        imageView = findViewById(R.id.splash_loading_item);
        Animation animation = AnimationUtils.loadAnimation(this,R.anim.splash_loading);
        animation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                Intent intent = new Intent(SppashActivity.this, AdActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.splash_left_start,R.anim.splash_left_end);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
        imageView.setAnimation(animation);
    }
}